<%@include file="menu/util.jsp" %>
<%@page contentType="text/html; charset=iso-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <fmt:bundle basename="app">
           <head>

        <%@include file="menu/wizardTablessHeader.jsp" %>

         <script type="text/javascript">

        //validator
        $.validator.setDefaults({
            submitHandler: function() {
               var name = $('#name').attr('value');
               var description = $('#description').attr('value');
               var smtp = $('#smtp').attr('value');
               var mail = $('#mail').attr('value');
               var password = $('#password').attr('value');

           if($('#smtpId').attr('value') > 0){

               var id = $('#smtpId').attr('value');
            editSMTP(id,name,description,smtp,mail,password);


            }else{
  
            insertSmtp(name,description,smtp,mail,password);
            }





    }
        });

        $().ready(function() {
	// validate the comment form when it is submitted
            $("#newSMTP").validate({
		errorLabelContainer: $(".errorDiv"),
                wrapper: "li"
	});
            $("#smtpId").change(function(){



            selectComparation($(this).val());
        });





        });
    </script>

    <c:set var="name" value=""/>
    <c:set var="description" value=""/>
    <c:set var="smtprotocol" value=""/>
    <c:set var="mail" value=""/>
    <c:set var="password" value=""/>
    <c:set var="id" value="-1"/>

    <c:if test="${smtp != null}" >
        <c:set var="name" value="${smtp.name}"/>
        <c:set var="description" value="${smtp.description}"/>
        <c:set var="smtprotocol" value="${smtp.smtpServer}"/>
        <c:set var="mail" value="${smtp.mail}"/>
        <c:set var="password" value="${smtp.password}"/>
        <c:set var="id" value="${smtp.idSMTP}"/>
    </c:if>


        </head>

    <body style="overflow:hidden;" >
         <form id="newSMTP" action="newSMTP.do">

<%@include file="menu/wizardTablessHeader2.jsp" %>

            <table>



            <tr>
                <td>
                    <fmt:message key="forms.name" />
                </td>
                <td>
                    <input class="required" title="<fmt:message key="error.smtp.name"/>" type="text" name="name" id="name" value="${name}" />
                </td>
            </tr>
                            <tr>
                <td>
                    <fmt:message key="forms.description" />
                </td>
                <td>
                    <input class="required" title="<fmt:message key="error.smtp.description"/>" type="text" name="description" id="description" value="${description}" />
                </td>
            </tr>
                            <tr>
                <td>
                    <fmt:message key="forms.smtp" />
                </td>
                <td>
                    <input class="required" title="<fmt:message key="error.smtp.smtp"/>" type="text" name="smtp" id="smtp" value="${smtprotocol}" />
                </td>
            </tr>
                            <tr>
                <td>
                    <fmt:message key="forms.mail" />
                </td>
                <td>
                    <input class="required" title="<fmt:message key="error.smtp.mail"/>" type="text" name="mail" id="mail" value="${mail}" />
                </td>
            </tr>
                            <tr>
                <td>
                    <fmt:message key="forms.password" />
                </td>
                <td>
                    <input class="required" title="<fmt:message key="error.smtp.password"/>" type="password" name="password" id="password" value="${password}" />
                </td>
            </tr>

            <tr>
                <td colspan="2">
                </td>
            </tr>
        </table>
  <input type="hidden" id="smtpId" name="smtpId" value="${id}" />

<%@include file="menu/wizardTablessMidle.jsp" %>
<%@include file="menu/wizardTablessFooter.jsp" %>
         </form>

    </body>
  </fmt:bundle>
</html>
